package com.personalsystem.role.dao.impl;

import java.io.Serializable;

import org.springframework.stereotype.Component;

import com.personalsystem.role.bean.Role;
import com.personalsystem.role.dao.RoleDao;
import com.personalsystem.tool.hibernate.BaseDaoImpl;
import com.personalsystem.tool.hibernate.Finder;
import com.personalsystem.tool.page.Page;


@Component("roleDao")
public class RoleDaoImpl extends BaseDaoImpl<Role> implements RoleDao{

	@Override
	public Role deleteById(Serializable id) {
		// TODO Auto-generated method stub
		Role role=get(id);
		role.setStatus(-10);
		role=(Role)update(role);
		return role;
	}

	public Page getPage(int pageNo, int pageSize) {
		// TODO Auto-generated method stub
		Finder finder=Finder.create("from Role where status!=-10");
		return find(finder, pageNo, pageSize);
	}

}
